package br.com.strings_serializacao;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Objetivo:
 * @author Sidney
 *
 */
public class ExemploDiretorio3 {
	public static void main(String[] args) {
		File f = new File("/teste/T4/T5");
		f.mkdir();
		File arq = new File(f,"Novo.txt");
		try{
			arq.createNewFile();
			//essa instrucao so e possivel a partir do java 5
			PrintWriter pw =  new PrintWriter(arq);
			pw.write("Teste usando print writer com um File no construtor");
			pw.flush();
			pw.close();
			
			FileReader fr = new FileReader(arq);
			BufferedReader br = new BufferedReader(fr);
			String s;
			while((s = br.readLine()) != null){
			System.out.println(s);	
			}			
		}catch(IOException e){e.printStackTrace();}
	}
}
